<extend name="Public/base" />

<block name="body">
    <form method="POST" id="form1" action="{:U('Report/exportsellsreportdaliy')}">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>
                销售日/月报（业务员）
                <a onclick="formExport();" class="btn confirm btn-default">excel导出</a>
            </h2>
        </div>
        <input type="hidden" id="datetimeBegin_hid" name="beginTime" value="{$beginTime}" />
        <input type="hidden" id="datetimeEnd_hid" name="endTime" value="{$endTime}" />
    </form>
    <form method="POST" id="form2" action="{:U('Report/sellsreportdaliy')}">
        <div class="navbar navbar-default" style="margin: 0px;">
            <div class="search-form " style="margin-top: 10px;margin-left: 10px;">
                    开始时间：<input type="text" id="datetimeBegin" name="beginTime" value="{$beginTime}" />
                    截止时间：<input type="text" id="datetimeEnd" name="endTime" value="{$endTime}" />
                    <input type="submit" class="btn btn-primary" value="统计"/>
            </div>
        </div>
    </form>
        <!-- 数据列表 -->
        <div class="data-table table-striped">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th width="7%">日期</th>
                    <th width="7%">业务员</th>
                    <th width="7%">成交金额</th>
                    <th width="7%">总单数</th>
                    <th width="7%">退款金额</th>
                    <th width="7%">退款率</th>
                    <th width="7%">平均客单价</th>
                    <th width="7%">无货退款</th>
                    <th width="7%">退款率</th>
                    <th width="7%">质量退款</th>
                    <th width="7%">退款率</th>
                    <th width="7%">非质量退款</th>
                    <th width="7%">退款率</th>
                    <th width="7%">活跃客户数</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                        <td>{$vo["dateFlag"]} </td>
                        <td>{$vo["sname"]} </td>
                        <td>{$vo["totalamount"]} </td>
                        <td>{$vo["totalcount"]} </td>
                        <td>{$vo["tdtotalprice"]} </td>
                        <td>{$vo["tdtotalpricerate"]} </td>
                        <td>{$vo["personalamount"]} </td>
                        <td>{$vo["no_goods_total"]} </td>
                        <td>{$vo["no_goods_total_rate"]} </td>
                        <td>{$vo["low_quantity_total"]} </td>
                        <td>{$vo["low_quantity_total_rate"]} </td>
                        <td>{$vo["no_reason_total"]} </td>
                        <td>{$vo["no_reason_total_rate"]} </td>
                        <td>{$vo["activeusercount"]} </td>
                        <td></td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
                </tbody>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>

</block>
<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">

        //导航高亮
        highlight_subnav('{:U('Report/sellsreportdaliy')}');

        $(function () {
            $('#datetimeBegin').datetimepicker({
                timepicker:false,
                format:'Y-m-d H:i',
                language: 'zh-CN',
                autoclose: true
            });
            $('#datetimeEnd').datetimepicker({
                timepicker:false,
                format:'Y-m-d H:i',
                language: 'zh-CN',
                autoclose: true
            });

            var currentTime=new Date();
            var dateTimeBegin=currentTime.getFullYear()+"-"+parseFloat(currentTime.getMonth()+1)+"-"+parseFloat(currentTime.getDate()-1)+" 12:00";
            var dateTimeEnd=currentTime.getFullYear()+"-"+parseFloat(currentTime.getMonth()+1)+"-"+currentTime.getDate()+" 12:00";
            if( $('#datetimeBegin').val()==""){
                $('#datetimeBegin').val(dateTimeBegin);
                $('#datetimeBegin_hid').val(dateTimeBegin);
            }
            if( $('#datetimeEnd').val()==""){
                $('#datetimeEnd').val(dateTimeEnd);
                $('#datetimeEnd_hid').val(dateTimeEnd);
            }
        })

        function formExport(){
            $('#form1').submit();
        }
    </script>
</block>
